import request from "@/utils/request";
import { IQueryParams, IIdParams, IStatusParams, ITableListItem, mitParams } from "./data.d";

// 列表
export async function queryList(data?: IQueryParams): Promise<any> {
	return request({
		url: "/nutrition/admin/medicalInstitution/pageList",
		method: "post",
		data,
	});
}

//  状态
export async function editStatus(params: IStatusParams): Promise<any> {
	return request({
		url: "/nutrition/admin/medicalInstitution/updateMedicalInstitutionStatus",
		method: "get",
		params,
	});
}

// 删除
export async function deleteItem(params: IIdParams): Promise<any> {
	return request({
		url: "/nutrition/admin/medicalInstitution",
		method: "delete",
		params,
	});
}

// 导出
export async function exportExcel(data?: IQueryParams): Promise<any> {
	return request({
		url: "/nutrition/admin/medicalInstitution/downloadExcel",
		method: "post",
		responseType: "blob",
		data,
	});
}

// 新增
export async function addItem(data: ITableListItem): Promise<any> {
	return request({
		url: "/nutrition/admin/medicalInstitution",
		method: "post",
		data,
	});
}

// 获取编辑用户信息
export async function getItem(params: IIdParams): Promise<any> {
	return request({
		url: "/nutrition/admin/medicalInstitution/detail",
		method: "get",
		params,
	});
}

// 编辑
export async function editItem(data: ITableListItem): Promise<any> {
	return request({
		url: "/nutrition/admin/medicalInstitution",
		method: "put",
		data,
	});
}

// 获取机构等级、类型
export async function medicalInstitutionTypeAndLevel(params: mitParams): Promise<any> {
	return request({
		url: "/nutrition/admin/dict/selectByPCode",
		method: "get",
		params,
	});
}
